<template>
    <div>
         <ul>
             <li v-for="(item, index) in arr" :key="item">
            <span>{{ item }}</span>
            <button @click="a1(index)">删除</button>
            </li>
         </ul>
         <button @click="a2">增加</button>
    </div>
</template>

<script>
export default {
         data(){
             return {
                  arr:[1,2,3]
             }
         },
         methods:{
            a1(index){
                this.arr.splice(index,1)
            },
            a2(){
                this.arr.push(Math.floor(Math.random()*9))
            }
         }
}
</script>

<style>

</style>